package entity

import (
	"shqsoft.cn/pasnj/base"

	"github.com/jinzhu/gorm"
)

//经济资本
type CompClieSxjeSc struct {
	ID   int     `gorm:"AUTO_INCREMENT;primary_key;column:ID"`
	ENCD string  `gorm:"column:ENCD"` //借据号
	CUNM string  `gorm:"column:CUNM"` //经营单位
	SXJE float64 `gorm:"column:SXJE"` //经营单位
	DRJG string  `gorm:"column:DRJG"` //经营单位
}

//TableName 客户授信金额
func (CompClieSxjeSc) TableName() string {
	return "T_COMP_CLIE_SXJE_SC"
}

//导入后执行分户处理
func ClieSxjeAfterImport(tx *gorm.DB, params map[string]string) (err error) {
	tx.Exec("exec UP_COMP_CLIE_SXJE_SC")
	//tx.Exec("UPDATE T_CM_CORP_CUST_DIM SET SXJE=B.SXJE FROM T_CM_CORP_CUST_DIM A INNER JOIN T_COMP_CLIE_SXJE_SC B ON A.ORG_ORG_CD=B.ENCD")
	return nil
}

func CompClieSxjeScEF() base.EntityFunc {
	return func() interface{} {
		entity := CompClieSxjeSc{}
		return &entity
	}
}
func CompClieSxjeScESF() base.EntitiesFunc {
	return func() interface{} {
		var entities []CompClieSxjeSc
		return &entities
	}
}

func init() {
	base.DaoPoolObj.Put("CompClieSxjeSc", base.NewDefaultDao(CompClieSxjeScEF(), CompClieSxjeScESF(), nil))
	base.SetAfterCallBack("CompClieSxjeSc", ClieSxjeAfterImport)
}
